/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jni;

import com.pretty_tools.dde.DDEException;
import com.pretty_tools.dde.client.DDEClientConversation;
import java.util.List;
import util.StringUtil;

/**
 *
 * @author phat10130059
 */
public class DDEClientUrlBrowser {

    public static String getUrlBrowser(String nameProcessBrowser) {
        String tmp = "";
        try {
//            DDEClientUrlBrowser ddeClientUrlBrowser = new DDEClientUrlBrowser();

         
            DDEClientConversation ddeClientConversation = new DDEClientConversation();

            ddeClientConversation.connect(nameProcessBrowser, "WWW_GetWindowInfo");

            String url = ddeClientConversation.request("0xFFFFFFFF");

            List<String> list = StringUtil.cutUrl(url);

            if (list.size() > 0) {
//                System.out.println("paht");
                tmp = list.get(1).toLowerCase();
            }

            ddeClientConversation.disconnect();



        } catch (DDEException ex) {
            ex.printStackTrace();
        }

        return tmp;

    }
}
